
<html>

    <body>
        <div id="main">
            <div id="content">
                <div id="masthead">
                    <span class="head">Enviar Sugerencia</span>
                    <ul class="breadcrumbs">
                        <li>
                            <?php
                            if ($this->session->userdata('tipo') == 1) {
                                echo "Administrador";
                            } else if ($this->session->userdata('tipo') == 2) {
                                echo "Jefe";
                            }else
                                echo "Usuario";
                            ?> : 
                            Hola <?php echo $this->session->userdata('username'); ?></li>

                    </ul>
                </div>
                <!-- ENDS Headline -->
                <div id="page-content-full">

                    <form id="contactForm" >

                        <h3 class="heading">Favor Brindarnos la sugerencia</h3>
                        <fieldset>
                            <h4>Título</h4>
                            <div>
                                <input name="subject"  id="subject" type="text" cols="20" class="form-poshytip" title="Escriba el titulo aqui" />

                            </div>
                            <h4>Sugerencia</h4>
                            <div>
                                <textarea  name="comments"  id="comments" rows="5" cols="15" class="form-poshytip" title="Escriba la sugerencia aqui"></textarea>
                            </div>

                        </fieldset>

                    </form>
                    <div id ="info" style="color:red" style="font-size:15px;"> </div>


                    <input type="submit" name="Submit" value="Enviar" class="boton" id="Agregar"/>
                    <input type="reset" value="Borrar" class="boton" id="boton" />&nbsp;




                    <br>
                    <br>
                </div>


            </div>
        </div>
        <div class="clearfix"></div>
        <div class="shadow-main"></div>
    </body>

    <script type="text/javascript">

        $('#Agregar').click(function(){
            var Ssubject = $("#subject").val();
            var Scomments = $("#subject").val() + "\n\n" + $("#comments").val();
            //            alert(Ssubject);
            //            alert(Scomments);
            var msj;
            if(!Ssubject || !Scomments){
                msj = 1;
            }
            else{ 
                msj = 0;
            }

            
            var form_data = {
                subject: Ssubject,
                comments: Scomments,
                msj: msj,
                ajax: '1'
            };
            
            
               
            $.ajax({
                url: "<?php echo site_url('configuraciones/enviar_sugerencia'); ?>",
                type: 'POST',
                data: form_data,
                success: function(msg){
                    $('#info').html(msg);
                }
            
            });
        
            setTimeout('document.getElementById("contactForm").reset();',8000);
            setTimeout('document.getElementById("info").innerHTML="";',3000);
            return false; 
        });    
    
    </script>
</html>